package com.sunny.design.observer.guava.gper;

import com.google.common.eventbus.Subscribe;
import com.sunny.design.observer.jdk.BaiDu;

import java.util.Observable;
import java.util.Observer;

public class Teacher {

    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    /**
     * 当被观察者的状态发生变化后，观察者就会收到消息进行处理
     */
    @Subscribe
    public void subscribe(Question question) {
        System.out.println(getName() + "老师您好，您收到了一个来自：" + question.getUserName() + "的提问！请您解答！问题内容如下：");
        System.out.println(question.getContent());
    }

    public String getName() {
        return name;
    }
}
